Current Limit 4 Click
Current Limit 4 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Nenad Filipovic
- Date : Aug 2023.
- Type : ADC/I2C type
Software Support
Example Description
This library contains API for the Current Limit 4 Click driver for the current limiting to a certain value and displays the sources a current proportional to the load current [A].
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.CurrentLimit4
Example Key Functions
- currentlimit4_cfg_setup Config Object Initialization function.
void currentlimit4_cfg_setup(currentlimit4_cfg_t *cfg)
Current Limit 4 configuration object setup function.
Current Limit 4 Click configuration object.
Definition currentlimit4.h:186
- currentlimit4_init Initialization function.
err_t currentlimit4_init(currentlimit4_t *ctx, currentlimit4_cfg_t *cfg)
Current Limit 4 initialization function.
Current Limit 4 Click context object.
Definition currentlimit4.h:168
- currentlimit4_default_cfg Click Default Configuration function.
err_t currentlimit4_default_cfg(currentlimit4_t *ctx)
Current Limit 4 default configuration function.
- currentlimit4_set_limit Current Limit 4 set current limit function.
err_t currentlimit4_set_limit(currentlimit4_t *ctx, uint16_t ilimit_ma)
Current Limit 4 set current limit function.
- currentlimit4_get_current Current Limit 4 get current function.
err_t currentlimit4_get_current(currentlimit4_t *ctx, float *current)
Current Limit 4 get current function.
- currentlimit4_get_power_good Current Limit 4 power good indication function.
uint8_t currentlimit4_get_power_good(currentlimit4_t *ctx)
Current Limit 4 power good indication function.
Application Init
Initialization of I2C and ADC module and log UART. After driver initialization, the app executes a default configuration and set the minimum current limit threshold to 1.0 [A].
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( ( ADC_ERROR == init_flag ) || ( I2C_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
Delay_ms ( 100 );
}
@ CURRENTLIMIT4_ERROR
Definition currentlimit4.h:208
#define CURRENTLIMIT4_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition currentlimit4.h:142
void application_init(void)
Definition main.c:34
Application Task
This example demonstrates the use of the Current Limit 4 Click board™. The demo application displays the source current proportional to the load current and an appropriate message when the current reaches the limit. Results are being sent to the UART Terminal, where you can track their changes.
{
static float current = 0;
{
{
log_printf( &logger, " Current : %.3f [A]\r\n", current );
}
else
{
log_printf( &logger, " Input voltage is lower then undervoltage protection threshold.\r\n" );
}
Delay_ms ( 1000 );
}
}
@ CURRENTLIMIT4_OK
Definition currentlimit4.h:207
#define CURRENTLIMIT4_POWER_GOOD
Current Limit 4 power good indication states.
Definition currentlimit4.h:116
void application_task(void)
Definition main.c:72
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.